import axios from "axios";
let baseURL = "";
if (process.env.NODE_ENV == "development") {
  baseURL = "https://api.aslegou.top";
} else {
  baseURL = "https://api.aslegou.top";
}
const http = axios.create({
  baseURL,
});
http.interceptors.request.use(
  function (config) {
    config.headers.Authorization = window.localStorage.getItem("token");
    return config;
  },
  () => {}
);
http.interceptors.response.use(
  function (response) {
    return response;
  },
  () => {}
);
export const getData = (url, params = {}) => {
  return http.get(url, {
    params,
  });
};
export const postData = (url, params = {}) => {
  return http.post(url, params);
};
